package summer_vacation.cullen.three10;

import java.util.Scanner;

/**
 * Created by Cullen on 2015/8/13.
 */
public class N32 {
    public static void main(String[] args) {
        System.out.print("请输入一个数字：");
        Scanner input=new Scanner(System.in);
        int m=input.nextInt();
        int sum=0;
        int a,b,c,d;
        d=m%10;
        c=(m-d)%100/10;
        b=(m-d-c*10)%1000/100;
        a=(m-d-c*10-b*100)/1000;
        sum=a*a+b*b+c*c+d*d;
        System.out.print("您输入的数字是："+m+"各位数字之和为："+sum );
    }
}
